# 所有对话日志
import logging
import os

# 获取当前脚本所在目录的路径
current_dir = os.path.dirname(os.path.abspath(__file__))

# 项目根目录路径
project_root = os.path.dirname(current_dir)


logger_all = logging.getLogger('all_logger')
logger_all.setLevel(logging.INFO)  # 设置日志级别

# 创建一个文件处理器
fh_all = logging.FileHandler(os.path.join(project_root, "log", "all_qa.log"))
fh_all.setLevel(logging.INFO)  # 设置文件处理器的日志级别

logger_all.addHandler(fh_all)

# 反馈对话日志
logger_ass = logging.getLogger('ass_logger')
logger_ass.setLevel(logging.INFO)

fh_ass = logging.FileHandler(os.path.join(project_root, "log", "assistant_qa.log"))
fh_ass.setLevel(logging.INFO)

# 将文件处理器添加到日志记录器
logger_ass.addHandler(fh_ass)

# 错误日志
logger_err = logging.getLogger('err_logger')
logger_err.setLevel(logging.ERROR)
fh_err = logging.FileHandler(os.path.join(project_root, "log", "error.log"))
fh_err.setLevel(logging.ERROR)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh_err.setFormatter(formatter)
logger_err.addHandler(fh_err)
